/**
 * ${table.comment!} View
 * @author jianshengxiong
 */

import React from "react";
import ${entity}Controller from "../controller/${entity}Controller";
import { Button } from "antd";
import { BizTable } from "win-trade-base";
import { get${entity}Cols } from "./${entity}Cols";
import ${entity}Modal from "./${entity}Modal";
import ${entity}SearchForm from "./${entity}SearchForm";
import "../style/${entity}.css";

class ${entity}View extends ${entity}Controller {
    render() {
        return (
            <div className="main">

                <${entity}SearchForm
                    wrappedComponentRef={ref => (this.$searchForm = ref)}
                    handleSearch={() => this.get${entity}PageList()}
                />

                <div className="table-tools">
                    <Button icon="plus" shape="round" onClick={() => this.$${entity?uncap_first}Modal.handleAdd()}>
                        新增
                    </Button>
                    <Button icon="check-circle" shape="round" onClick={this.batchHandleAudit}>
                        审核
                    </Button>
                    <Button icon="undo" shape="round" onClick={this.batchHandleUnAudit}>
                        反审核
                    </Button>
                    <Button icon="delete" shape="round" onClick={this.batchHandleRemove}>
                        删除
                    </Button>
                </div>

                <${entity}Modal
                    {...this.state}
                    ref={ref => this.$${entity?uncap_first}Modal = ref}
                    loadData={this.get${entity}PageList}
                />

                <BizTable
                    className="stripe-table"
                    rowSelection
                    scollX={true}
                    scollY={document.body.clientHeight - 137}
                    columns={get${entity}Cols(this)}
                    activeKeys="1"
                    dataSource={this.state.pageList}
                    total={this.state.total}
                    loadData={(page, pageSize) => this.get${entity}PageList(page, pageSize)}
                    pagination={{
                        defaultPageSize: 20
                    }}
                    ref={ref => (this.$${entity?uncap_first}Table = ref)}
                />
            </div>
        );
    }
}

export default ${entity}View;
